package com.heer.gymnasium.adapter;


import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import com.heer.gymnasium.R;
import com.heer.model.SitePlaceCateBean;

import butterknife.BindView;
import butterknife.ButterKnife;

/**
 * Created by admin on 2017/7/11.
 */

public class PlaceCateTitleAdapter extends ListAdapter<SitePlaceCateBean> {


    public PlaceCateTitleAdapter(Context context) {
        super(context);
    }

    @Override
    public View getView(int position, View view, ViewGroup parent) {
        ViewHolder holder;
        if (view!=null)
        {
            holder= (ViewHolder) view.getTag();
        }else
        {
            view=mInflater.inflate(R.layout.item_place_layout,parent,false);
            holder=new ViewHolder(view);
            view.setTag(holder);
        }
        SitePlaceCateBean item=getItem(position);
        holder.tvTitle.setText(item.getCate_name());
        holder.tv_list.setText(item.getCate_name().substring(0,1));
        holder.lineCrudeTop.setVisibility(View.GONE);
        holder.lineFineTop.setVisibility(View.GONE);
        holder.lineCrudeBottom.setVisibility(View.VISIBLE);
        holder.lineFineBottom.setVisibility(View.VISIBLE);
        return view;
    }

    static class ViewHolder{
        @BindView(R.id.tv_iplace_title)
        TextView tvTitle;
        @BindView(R.id.line_fine_top)
        View lineFineTop;
        @BindView(R.id.line_crude_top)
        View lineCrudeTop;
        @BindView(R.id.line_fine_bottom)
        View lineFineBottom;
        @BindView(R.id.line_crude_bottom)
        View lineCrudeBottom;
        @BindView(R.id.tv_iplace_lift)
                TextView tv_list;


        ViewHolder(View view)
        {
            ButterKnife.bind(this,view);
        }

    }


}
